#ifndef STUDENT_PUB_H
#define STUDENT_PUB_H

#define MAX_NAME_LEN 50
#define MAX_COURSES 10

// 学生结构体
typedef struct {
    char id[20];                    // 学号
    char name[MAX_NAME_LEN];        // 姓名
    char selected_courses[MAX_COURSES][20];  // 已选课程列表
    int course_count;               // 已选课程数量
    float total_credits;            // 总学分
} Student;

// 学生链表节点
typedef struct StudentNode {
    Student student;
    struct StudentNode* next;
} StudentNode;

// 学生链表
typedef struct {
    StudentNode* head;
    int count;
} StudentList;

// 公共接口函数声明
StudentList* create_student_list();
void free_student_list(StudentList* list);
int add_student(StudentList* list, const char* id, const char* name);
int delete_student(StudentList* list, const char* id);
Student* find_student(StudentList* list, const char* id);
int update_student(StudentList* list, const char* id, const char* new_name);
void display_all_students(StudentList* list);
void student_management_menu(StudentList* list);
int add_course_to_student(StudentList* list, const char* student_id, 
                         const char* course_id, float credits);
int remove_course_from_student(StudentList* list, const char* student_id, 
                              const char* course_id);

#endif
